Python Data Science Handbook by Jake VanderPlas
Author: Jake VanderPlas , Date: May 19, 2019
, Views: 552
In[11]: plt.imshow(I, cmap=plt.cm.get_cmap('Blues', 6)) plt.colorbar() plt.clim(-1, 1);
Figure 4-56. A discretized colormap
The discrete version of a colormap can be used just like any other colormap.
Example: Handwritten Digits
For an example of where this might be useful, let’s look at an interesting visualization of some handwritten digits data. This data is included in Scikit-Learn, and consists of nearly 2,000 8×8 thumbnails showing various handwritten digits.
For now, let’s start by downloading the digits data and visualizing several of the example images with plt.imshow() (Figure 4-57):
Copyright Disclaimer:
This site does not store any files on its server. We only index and link
to content provided by other sites. Please contact the content providers
to delete copyright contents if any and email us, we'll remove relevant
links or contents immediately.